package DataStorage;
import java.io.Serializable;
import org.hibernate.LockMode;

import java.util.Collection;
import java.util.List;

public interface IGenericDAO <T, ID extends Serializable>{

	//------------The basic operation ---------------
	public int getNumberFiled(T entity);
	
	//get entity
	public T getEntity(ID id);
	public T getEntity(long id);
	public T getEntityFromHistroy(ID id);
	public T getEntityFromHistroy(long id);
	public T getEntityWithLock(ID id, boolean lock);
	@SuppressWarnings("rawtypes")
	public List getAllEntity();
	@SuppressWarnings("rawtypes")
	public List getEntityByExample(T exampleInstance);
	
	//save and update
	public void update(T entity);
	public void updateWithLock(T entity, LockMode lock);
	public void save(T entity);
	public void saveOrUpdate(T entity);
	public void saveOrUpAll(Collection<T> enttities);
	
	//delete 
	public void delete(T entity);
	public void deleteById(ID id);
	public void deleAll(Collection<T> entities);
	public void deleteFromHistory(T entity);
	public void deleteByIdFromHistory(ID id);
	public void deleAllFromHistory(Collection<T> entities);
	
	
	
}
